
<?php

  $id = !empty($_GET['id'])?$_GET['id']:''; //获取当前编辑的数据id

  if(!empty($_POST)){
/*     // 获取POST数据
    $name = $_POST['name'];
    $pid = $_POST['pid'];

    //修改语句
    $sql = "update `cate` set `name`='$name',`pid`='$pid' where `id`=$id ";
    //执行语句
    mysqli_query($link,$sql);
    //提取真值
    $_rows = mysqli_affected_rows($link);  //-1   0   1  */

    $_rows = edit('cate',$id,$_POST);


    if($_rows>=0){
      echo"<script>alert('分类修改成功');location.href='index.php?c=cate&a=list&admin=1';</script>";die;
    }else{
      echo"<script>alert('分类修改失败');history.go(-1)</script>";die;
    }
  }

/*  //查找当前编辑的数据
  $sql = "select * from `cate` where `id`=$id";
  //执行语句
  $result = mysqli_query($GLOBALS['link'],$sql);

  $data = mysqli_fetch_assoc($result);*/

  $data = getSelectByOne('cate',"id=$id");


  $cate = array_reverse(editCate($data),true);



  //加载后台公共视图

  include (View_PATH.$admin.'/communal.html');


?>

